/**
*  \file sdfile.h
*
*  \brief	Declaration of data structure for handling storage device file
*
*  \author  Michael Kunkelmann  <m.kunkelmann@webergmbh.de>
*
*
*/

#ifndef SDFILE_H_INCLUDED
#define SDFILE_H_INCLUDED

/*================================================[ public includes  ]================================================*/
#include <stdio.h>
#include "../cfg/prj.h"
#include "../sd/sd.h"
/*================================================[ public defines   ]================================================*/

/*================================================[ public datatypes ]================================================*/
struct sdfile_obj
{
	struct sd dev;    	/**< sd structure. Has to be always first element of this structure */
	sd_size_t file_size;/**< Size of this storage device in bytes */
	FILE *object;		/**< File handle */
};

/*================================================[ public variables ]================================================*/

/*================================================[ public functions ]================================================*/

/** Constructor
*
*  Function construct the storage device module
*
* \param me pointer to object from struct sdfile, it's not save to pass NULL
* \param txt pointer to file path, it's not save to pass NULL
* \param sdfile_size file size of the storing device
* \param init_value Value the file will be filled if it is new or it is foreced by force_cleanup.
* \param force_cleanup If TRUE is passed, the file will be filled with the init_value.
*
* \return RC_SUCCESS if file could be accessed, RC_ERROR if file doesn't exist
**/
RC sdfile_construct( struct sdfile_obj *me, CH * txt,U32 sdfile_size,U8 init_value, BO force_cleanup );

/** Closes the sdfile
*
*  Function closes the storage device file handle
*
* \param me pointer to object from struct sdfile
*
* \return RC at the moment always RC_SUCCESS
**/
RC sdfile_close( struct sdfile_obj *me );
/*====================================================================================================================*/

#endif

/***********************************************************************************************************************
*                             Copyright 2010,2011 Linde Material Handling. All rights reserved.                        *
***********************************************************************************************************************/
